<%@taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql"%>
<%-- 
    Document   : newCalendar
    Created on : 19-gen-2015, 12.48.17
    Author     : Jov
--%>
<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="java.sql.*"%>
<%@page import="java.io.*"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        
        <title>JSP Page</title>
    </head>
    <body>
        <h1>I-I-I'm here to create a new user, p-p-please be gentle, s-senpai-san!</h1>
        <%--
        <%
            try {
                String connectionURL = "jdbc:mysql://localhost:3306/meteocaldb";
                Connection connection = null;
                Class.forName("com.mysql.jdbc.Driver").newInstance();
                connection = DriverManager.getConnection(connectionURL, "root", "0000");

                Statement stmt = connection.createStatement();
                
                stmt.executeUpdate("INSERT INTO users VALUES (NULL,'"+request.getParameter("firstName")+"','"+request.getParameter("lastName")+"','"+request.getParameter("user")+"','"+request.getParameter("password")+"','"+request.getParameter("email")+"')");

                stmt.close();
                connection.close();
                
                out.println("<meta http-equiv='refresh' content='3; url=../login.jsp'>");

            } catch (Exception ex) {
                out.println("Errore! " + ex.getMessage().toString());
            }
        %>  
        --%>
        <sql:update var="newUser" dataSource="jdbc/MeteoCalBETA">
                        
            INSERT INTO users
            VALUES (NULL,${firstName},${lastName},${user},${password},${email})
        </sql:update>
            
    </body>
</html>
